package com.game;

import android.util.Log;

public class PuzzlePathArea {
	
	private final static String TAG = PuzzlePathArea.class.getSimpleName();
	
	private float leftEdge = 0;
	private float rightEdge = 0;
	private float topEdge = 0;
	private float bottomEdge = 0;
	
	PuzzlePathArea() {
		
	}
	
	PuzzlePathArea(float leftEdge, float topEdge, float rightEdge, float bottomEdge) {
		setRandomArea(leftEdge, topEdge, rightEdge, bottomEdge);
	}
	
	public void setRandomArea(float leftEdge, float topEdge, float rightEdge, float bottomEdge) {
		float swap = 0;
		if (leftEdge > rightEdge) {
			swap = leftEdge;
			leftEdge = rightEdge;
			rightEdge = swap;
		}
		if (topEdge > bottomEdge) {
			swap = topEdge;
			topEdge = bottomEdge;
			bottomEdge = swap;
		} 
		
		this.leftEdge = leftEdge;
		this.topEdge = topEdge;
		this.rightEdge = rightEdge;
		this.bottomEdge = bottomEdge;
	}
	
	public float getLeftEdge() {
		return leftEdge;
	}
	
	public float getTopEdge() {
		return topEdge;
	}
	
	public float getAreaWidth() {
		Log.v(TAG, "rightEdge " + rightEdge + " leftEdge " + leftEdge);
		return (rightEdge - leftEdge);
	}
	
	public float getAreaHeight() {
		return (bottomEdge - topEdge);
	}
	
}
